<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
 <%@ include file="/commons/taglibs.jsp"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>补充商户资料——注册第二步</title>
<link href="${ctx }/style/common.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="${ctx }/js/common.js"></script>
<script type="text/javascript" src="${ctx }/js/jquery-1.3.2.js"></script>
<script type="text/javascript">

	/**********提交前检查表单*****************/
	function checkForm(){

		 var companyName = $("#companyName").val().trim();
		 if( companyName  ==  ""){
			  $("#companyName").focus();
			  alert("请填写商户名称。");
			  return false;
		 }
		  
		 var  usertype = $('input[name="userType"]:checked').val();
		 if( usertype == "company"){
			 var yyzh = $("#yyzh").val().trim();
			 if( yyzh  ==  ""){
				  $("#yyzh").focus();
				  alert("请填写营业执照注册号。");
				  return false;
			  }
		 }

		 if( usertype == "personal"){
			  var idCard = $("#idCard").val().trim();
			  var idCardReg = /^(\d{14}|\d{17})(\d|[xX])$/; 
			  if( !idCardReg.test(idCard)){
				  $("#idCard").val("");
				  $("#idCard").focus();
				  alert("身份证号码填写错误。");
				  return false;
			  }
		 }

			var province = $("#provinceInfoSelect").val();
			if( province == ""){
				 alert("请选择所在省。");
				 return false;
			}

			var city = $("#cityInfoSelect").val();
			if( city == ""){
				 alert("请选择所在市县。");
				 return false;
			}
			
			var address = $.trim($("#address").val());
			if( address  ==  ""){
				$("#address").focus();
				alert("请填写区县及街道地址。");
				return false;
			}

			var zipCode = $.trim($("#zipCode").val());
			var zipCodeReg = /^[1-9][0-9]{5}$/;
			if( zipCode !="" && !zipCodeReg.test(zipCode) ){
				$("#zipCode").focus();
				 alert("邮政编码填写不正确。");
				 return false;
			}

		  var emailAddress = $("#emailAddress").val().trim();
		  var emailReg = /^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/;
		  if(!emailReg.test(emailAddress)){
			  $("#emailAddress").val("");
			  $("#emailAddress").focus();
			  alert("电子邮箱格式不正确。");
			  return false;
		  }

		  var account = $.trim($("#account").val());
		  if( account  ==  ""){
				$("#account").focus();
				alert("请填写结算账户户名。");
				return false;
		  }

			var bank = $.trim($("#bank").val());
			if( bank  ==  ""){
				$("#bank").focus();
				alert("请填写结算账户开户行。");
				return false;
			}

			var account_number = $.trim($("#account_number").val());
			if( account_number  ==  ""){
				$("#account_number").focus();
				alert("请填写结算账户开户行。");
				return false;
			}

		if(window.confirm("确认提交？")){
			$("#registerAdditionalForm").submit();
		}
	}

	function chooseUserType(flag){
		if(flag == 0){//个人用户
			$("#idCardTr").css("display","");
			$("#yyzhTr").css("display","none");
		}
		else if(flag == 1){//公司用户
			$("#idCardTr").css("display","none");
			$("#yyzhTr").css("display","");
		}
	}

</script>

<style type="text/css">
#main{padding-top: 20px;padding-bottom: 20px;margin: 0 auto;width: 960px;position: relative;z-index: 1;background: #ffffff;margin-top: 4px;}
.register_title{font-family: SimHei;font-size: 18px;color: #ff0000;padding: 10px 0px 10px 130px;}
.style15 {color: #FF6600}
</style>
</head>

<body>

<!-- 页面头部  -->
<jsp:include page="/commons/head.jsp"></jsp:include>

<div id="main">
<form action="${ctx }/member/memberAction!completeRegister.do" method="post" id="registerAdditionalForm" name="registerAdditionalForm">
  <table width="960" border="0" cellspacing="0" cellpadding="0">
          <tr>
           	 	<td colspan="2"><div class="register_title">请补充会员资料</div></td>
          </tr>
          <tr>
	            <td class="bt14A" align="right"><span class="style15">*</span>商户名称：</td>
	            <td class="bt14A">
	            	<input name="companyName" type="text" size="40" id="companyName"  maxlength="50" value="">
	            	<input name="userType" type="radio" value="company" checked="checked" onclick="chooseUserType(1)">公司
	    			<input name="userType" type="radio" value="personal" onclick="chooseUserType(0)">个人 
	            </td>
          </tr>
          <tr id="yyzhTr">
		         <td class="bt14A" align="right"><span class="style15">*</span>营业执照注册号：</td>
		         <td class="bt14A"><input name="yyzh" type="text" size="40" id="yyzh"  maxlength="50" value=""></td>
          </tr>
          <tr id="idCardTr" style="display: none">
	          	<td class="bt14A" align="right"><span class="style15">*</span>身份证：</td>
	          	<td class="bt14A"><input name="idCard" id="idCard" maxlength="20"  size="30"/></td>
          </tr>
          <tr>
            <td class="bt14A" align="right"><span class="style15">*</span>所在地：</td>
            <td class="bt14A">
                <select name="province" id="provinceInfoSelect" onchange="changeProvince()">
                        <option value="">选择省份</option>
                        <c:forEach items="${requestScope.provinceInfoList}" var="provinceInfo" varStatus="status">
				            <option value="${ provinceInfo.id}"/> ${ provinceInfo.name}</option>
				        </c:forEach>
                </select>
                <select name="city" id="cityInfoSelect">
                  <option value="">选择县市</option>
                </select>
                <input name="address" type="text" size="50" id="address">
               </td>
          </tr>
          <tr>
          		<td class="bt14A" align="right">邮码：</td>
          		<td class="bt14A"><input name="zipCode" id="zipCode" maxlength="20" size="30"/></td>
          </tr>
          <tr>
            <td class="bt14A" align="right">业务联系人：</td>
            <td class="bt14A"><input name="contact" type="text" size="20" id="contact" maxlength="40"></td>
          </tr>
          <tr>
            <td class="bt14A"  align="right">联系电话：</td>
            <td class="bt14A"><input name="tel" type="text" size="20" id="tel" maxlength="50">
            </td>
          </tr>
          <tr>
          		<td class="bt14A" align="right"><span class="style15">*</span>电子邮箱：</td>
          		<td class="bt14A"><input name="emailAddress" id="emailAddress" maxlength="50" size="30"/></td>
          </tr>
          
          <tr><td colspan="2"><div class="register_title">请填写结算账户</div></td></tr>
          <tr>
          		<td class="bt14A" align="right"><span class="style15">*</span>户名：</td>
          		<td class="bt14A"><input name="account" id="account" maxlength="50" size="30"/></td>
          </tr>
         <tr>
          		<td class="bt14A" align="right"><span class="style15">*</span>开户行：</td>
          		<td class="bt14A"><input name="bank" id="bank" maxlength="50" size="30"/></td>
         </tr>
         <tr>
          		<td class="bt14A" align="right"><span class="style15">*</span>账号：</td>
          		<td class="bt14A"><input name="account_number" id="account_number" maxlength="50" size="30"/></td>
          </tr>
         <tr>
            <td width="166">&nbsp;</td>
            <td width="539" class="nw12a" align="left">
           		 <img src="../images/an24.gif" width="114" height="31" onClick="javascript:checkForm()" style="cursor: pointer ;border: 0"></td>
          </tr>
  </table>
</form>
</div>

<jsp:include page="/commons/foot.jsp"></jsp:include>

</body>
</html>